﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using ZZQFrameWork;

/// <summary>
/// 技能面板的属性item
/// </summary>
class SkillPanelAttrItem:MonoBehaviour
{
    /// <summary>
    /// 名称
    /// </summary>
    private Text nameText;

    /// <summary>
    /// 数值
    /// </summary>
    private Text valueText;

    private AttrData data;

    public AttrData Data
    {
        get { return data; }
        set
        {
            data = value;
            UpdateShow();
        }
    }

    void Awake()
    {
        nameText = transform.GetComponentByPath<Text>("Name");
        valueText = transform.GetComponentByPath<Text>("Value");
    }

    private void UpdateShow()
    {
        if (nameText == null) nameText = transform.GetComponentByPath<Text>("Name");
        if (valueText == null) valueText = transform.GetComponentByPath<Text>("Value");
        nameText.text = Data.attrName;
        valueText.text = Data.attrValue.ToString();
    }

    /// <summary>
    /// 属性item点击
    /// </summary>
    /// <param name="click"></param>
    public void SetItemClicked(bool click)
    {
        
    }
}
